package sy.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import sy.pageModel.DataGrid;
import sy.pageModel.Json;
import sy.pageModel.PageOrderCash;
import sy.service.TOrderCashService;

@Controller
@RequestMapping("/tOrderCashController")
public class TOrderCashController {
	
	TOrderCashService tOrderCashService;
	
	
	public TOrderCashService gettOrderCashService() {
		return tOrderCashService;
	}
	@Autowired
	public void settOrderCashService(TOrderCashService tOrderCashService) {
		this.tOrderCashService = tOrderCashService;
	}

	@RequestMapping("/datagrid")
	@ResponseBody
	public DataGrid datagrid() {
		return this.tOrderCashService.treegrid(); 
	}
	
	@RequestMapping(value = "/add", method = RequestMethod.POST)
	@ResponseBody
	public Json add(PageOrderCash pageOrderCash) {
		Json j = new Json();
		j.setSuccess(true);
		j.setObj(tOrderCashService.add(pageOrderCash));
		j.setMsg("添加成功!");
		return j;
	}

	@RequestMapping(value = "/edit")
	@ResponseBody
	public Json edit(PageOrderCash pageOrderCash) {
		Json json = new Json();
		json.setSuccess(true);
		json.setObj(tOrderCashService.edit(pageOrderCash));
		json.setMsg("编辑成功");
		return json;
	}
	@RequestMapping(value = "/remove")
	@ResponseBody
	public Json remove(String ids) {
		Json json = new Json();
		tOrderCashService.remove(ids);
		json.setSuccess(true);
		json.setObj(ids);
		json.setMsg("删除成功");
		return json;
	}
	
}
